package com.ruoyi.workbench.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.workbench.dto.MatterSummary;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.workbench.domain.WorkMatterSummary;
import com.ruoyi.workbench.service.IWorkMatterSummaryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 事项总结Controller
 * 
 * @author Guojl
 * @date 2024-07-06
 */
@RestController
@RequestMapping("/summary/summary")
public class WorkMatterSummaryController extends BaseController
{
    @Autowired
    private IWorkMatterSummaryService workMatterSummaryService;

    /**
     * 查询事项总结列表
     */
    @PreAuthorize("@ss.hasPermi('summary:summary:list')")
    @GetMapping("/list")
    public TableDataInfo list(WorkMatterSummary workMatterSummary)
    {
        startPage();
        List<MatterSummary> list = workMatterSummaryService.selectWorkMatterSummaryList(workMatterSummary);
        return getDataTable(list);
    }

    /**
     * 获取事项总结详细信息
     */
    @GetMapping(value = "/{workSummaryId}")
    public AjaxResult getInfo(@PathVariable("workSummaryId") Long workSummaryId)
    {
        return success(workMatterSummaryService.selectWorkMatterSummaryByWorkSummaryId(workSummaryId));
    }

    /**
     * 新增事项总结
     */
    @Log(title = "事项总结", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WorkMatterSummary workMatterSummary)
    {
        return toAjax(workMatterSummaryService.insertWorkMatterSummary(workMatterSummary));
    }

    /**
     * 修改事项总结
     */
    @Log(title = "事项总结", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WorkMatterSummary workMatterSummary)
    {
        return toAjax(workMatterSummaryService.updateWorkMatterSummary(workMatterSummary));
    }

    /**
     * 删除事项总结
     */
    @Log(title = "事项总结", businessType = BusinessType.DELETE)
	@DeleteMapping("/{workSummaryIds}")
    public AjaxResult remove(@PathVariable Long[] workSummaryIds)
    {
        return toAjax(workMatterSummaryService.deleteWorkMatterSummaryByWorkSummaryIds(workSummaryIds));
    }
}
